import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '库区id',
    align:"center",
    dataIndex: 'wmsBasicWarehouseAreaId_dictText'
   },
   {
    title: '显示顺序',
    align:"center",
    dataIndex: 'orderIndex'
   },
   {
    title: '库位名称',
    align:"center",
    dataIndex: 'name'
   },
   {
    title: '库位编码',
    align:"center",
    dataIndex: 'code'
   },
   {
    title: '状态',
    align:"center",
    dataIndex: 'status_dictText'
   },
   {
    title: '备注',
    align:"center",
    dataIndex: 'description'
   },
   {
    title: '最大容量',
    align:"center",
    dataIndex: 'maxCapacity'
   },
   {
    title: '预警容量',
    align:"center",
    dataIndex: 'warningCapacity'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '库区id',
    field: 'wmsBasicWarehouseAreaId',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:""
     },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入库区id!'},
          ];
     },
  },
  {
    label: '显示顺序',
    field: 'orderIndex',
    defaultValue: 0,
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入显示顺序!'},
          ];
     },
  },
  {
    label: '库位名称',
    field: 'name',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入库位名称!'},
          ];
     },
  },
  {
    label: '库位编码',
    field: 'code',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入库位编码!'},
          ];
     },
  },
  {
    label: '状态',
    field: 'status',
    defaultValue: "1",
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"is_enabled"
     },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入状态!'},
          ];
     },
  },
  {
    label: '备注',
    field: 'description',
    component: 'InputTextArea',
  },
  {
    label: '最大容量',
    field: 'maxCapacity',
    component: 'InputNumber',
  },
  {
    label: '预警容量',
    field: 'warningCapacity',
    component: 'InputNumber',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];



/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}